package day.day7_7;


//public class Main {
//
//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        while (sc.hasNext()) {
//            int n = sc.nextInt();
//            int count = 0;
//            int maxCount = 0;
//            while (n != 0) {
//                if ((n & 1) == 1) {//表示当前位是1
//                    count++;
//                    maxCount = Math.max(maxCount, count);
//                } else {
//                    count = 0;
//                }
//                n >>= 1;//n左移一位
//            }
//            System.out.println(maxCount);
//        }
//    }
//}
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int num = sc.nextInt();
            //将数字转换为二进制字符串
            String s = Integer.toBinaryString(num);
            //将字符串按照0分割成若干个字符
            String[] str = s.split("0");
            int max = 0;
            //遍历每一段字符，统计1出现次数最多的子串
            for (String value : str) {
                if (value.length() > max) {
                    max = value.length();
                }
            }
            System.out.println(max);
        }
    }
}